import { getMainHtml } from "@/services/weather";
import { defineStore } from "pinia";

const useMainStore = defineStore("main", {
  state: () => ({
    main: {},
    hour24: [],
    day7: [],
    air: {},
    indices: [],
  }),
  actions: {
    async fetchMainData(city, code) {
      const res = await getMainHtml(city, code);
      this.main = res.main;
      this.hour24 = res.hour24;
      this.day7 = res.day7;
      this.air = res.air;
      this.indices = res.indices;
    },
  },
});

export default useMainStore;
